package com.zhang.zxx.boot.controller;

import com.zhang.zxx.boot.common.base.Response;
import com.zhang.zxx.boot.common.core.aop.MvcLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * ApiController:API测试
 *
 * @author zhangxiaoxiang
 * @date 2021/12/05
 */
@Api(tags = "API测试模块")
@RestController
@RequestMapping("/api")
@Slf4j
@RequiredArgsConstructor
public class ApiController {
    @MvcLog
    @ApiOperation(value = "测试MvcLog的RequestParam参数")
    @PostMapping("/test1")
    public Response<String> test1(@RequestParam("name") String name,
                                  @RequestParam("addr") String addr,
                                  @RequestParam("phone") String phone,
                                  String age,
                                  String like

    ) {

        return Response.data("test");
    }

    @MvcLog
    @ApiOperation(value = "测试MvcLog文件上传")
    @PostMapping("/test2")
    public Response<String> test2(@RequestParam("file") MultipartFile file) {
        log.info("-----------");
        return Response.data("测试MvcLog文件上传");
    }

}
